﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using weikebuluo.Common;
using weikebuluo.DAL;

namespace weikeweixin.web.admin.website
{
    public partial class newsclass : weikeweixin.web.admin.cs.adminbase
    {
        JsonOperate JsonOperate = new JsonOperate();
        t_newscate_dal NewsCategoryDAL = new t_newscate_dal();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(user_id))
            {
                Response.Write("<script Language=\"Javascript\">alert(\"请先配置微官网\")");
                Response.Write("</script>");
                Response.End();
            }
            switch (Request.QueryString["action"])
            {
                case "list":
                    GetList();
                    break;
                case "del":
                    Delete();
                    break;
            }
        }

        private void Delete()
        {
            bool bl = NewsCategoryDAL.Delete(int.Parse(Request.QueryString["id"].Trim()));
        }

        private void GetList()
        {
            Response.Write(JsonOperate.TableToBasicJson(NewsCategoryDAL.GetList("user_id=" + user_id).Tables[0]));
            Response.End();
        }
    }
}